package com.lhj.bootdemo.designmode.proxy.cglib;

import org.springframework.cglib.proxy.Enhancer;

/**
 * @author lhj
 * @version 1.0
 * @date 2022/5/18 10:05 上午
 * @description:
 */

public class CglibObjectFactory {

    public static <T> T getProxiedObject(Class clazz) {
        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(clazz);
        enhancer.setCallback(new CglibProxy());
        T o = (T) enhancer.create();
        return o;
    }
}
